﻿import QtQuick 2.15
import QtQuick.Controls 2.15

Item {
    width: screenWidth
    height: screenHeight

    Item{
        id:backGround
        anchors.fill: parent
    }

    // 当前页码
    property real currentPanel: 0

    // 细分界面切换按钮是否可控
    property bool bottomSwitchBtnEnabled: false

    Rectangle{
        id:managerPanel
        anchors.top: backGround.top
        anchors.topMargin: 200
        anchors.left: backGround.left
        anchors.leftMargin: 10
        color: "#0b49b0"
        border.width: 1
        border.color: "#008edd"
        width: 1060
        height: 1400


        Text {
            anchors.top: parent.top
            anchors.topMargin: 300
            anchors.horizontalCenter: parent.horizontalCenter
            font.pixelSize: 60
            font.bold: true
            color: "red"
            text: "请在下方输入管理员密码以继续操作"
        }

        Text{
            anchors.top: parent.top
            anchors.topMargin: 530
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 40
            font.bold: true
            color: "white"
            text:"账号:"
        }

        TextField{          // 管理员账号
            id:managerAccount
            anchors.top: parent.top
            anchors.topMargin: 510
            anchors.left: parent.left
            anchors.leftMargin: 340
            width: 400
            height: 80
            font.pixelSize: 40
            font.bold: true
            maximumLength: 9
            text:"admin"

        }

        Text{
            anchors.top: parent.top
            anchors.topMargin: 690
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 40
            font.bold: true
            color: "white"
            text:"密码:"
        }

        TextField{          // 管理员密码
            id:managerPasswd
            anchors.top: parent.top
            anchors.topMargin: 670
            anchors.left: parent.left
            anchors.leftMargin: 340
            width: 400
            height: 80
            font.pixelSize: 40
            font.bold: true
            maximumLength: 9

        }


        Rectangle{
            anchors.top: parent.top
            anchors.topMargin: 900
            anchors.left: parent.left
            anchors.leftMargin: 270
            radius: 10
            width: 175
            height: 80
            color: "#3085f6"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text:"登录"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                }

                onReleased: {
                    parent.color = "#2b6ec5"

                    if(managerAccount.text === "admin" && managerPasswd.text === "123")
                    {
                        bottomSwitchBtnEnabled = true
                        parameterSettingPanel.visible = false
                        commonSettingPanel.visible = true
                        Cpp_Connect.setQmlPage(8);
                    }
                    else
                    {
                        bottomSwitchBtnEnabled = false
                    }
                }
            }
        }

        Rectangle{
            anchors.top: parent.top
            anchors.topMargin: 900
            anchors.left: parent.left
            anchors.leftMargin: 600
            radius: 10
            width: 175
            height: 80
            color: "#3085f6"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text:"取消"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    managerAccount.clear()
                    managerPasswd.clear()
                }
            }
        }

    }

}
